@extends('admin.public.base')

@section('title', '权限列表')

@section('content')
    <nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 权限管理 <span
                class="c-gray en">&gt;</span> 权限列表 <a class="btn btn-success radius r"
                                                      style="line-height:1.6em;margin-top:3px"
                                                      href="javascript:location.replace(location.href);" title="刷新"><i
                    class="Hui-iconfont">&#xe68f;</i></a>
    </nav>

    @if(session('status'))
        <script>
            setTimeout(() => {
                layer.msg("{{session('status')}}");
            }, 100)
        </script>
    @endif

    <div class="Hui-article">
        <article class="cl pd-20">
            <div class="cl pd-5 bg-1 bk-gray mt-20"><span class="l">
                    <a class="btn btn-primary radius" href="/admin/permissadd/0">
                        <i class="Hui-iconfont">&#xe600;</i>添加顶级权限</a></span>
            </div>
            <table class="table table-border table-bordered table-bg table-hover table-sort">
                <tr>
                    <td width="80">名称</td>
                    <td width="80">规则</td>
                    <td width="20">编辑</td>
                </tr>

                @foreach ($permissDatas as $permissData)
                    <tr>
                        <td>{!! $permissData['_name'] !!}</td>
                        <td>{!! $permissData['name'] !!}</td>
                        <td>
                            <a href="/admin/permissadd/{{$permissData['id']}}" class="btn btn-xs btn-info">添加子权限</a>
                            <a href="/admin/permissedit/{{$permissData['id']}}" class="btn btn-xs btn-warning">编辑权限</a>
                            <form action="/admin/permissdel/{{$permissData['id']}}" method="post" style="display: inline">
                                @csrf
                                <button onclick="return confirm('ok？')" type="submit" class="btn btn-xs btn-danger">删除
                                </button>
                            </form>
                        </td>
                    </tr>
                @endforeach
            </table>
        </article>
    </div>
@endsection
